package Comp355Final.main;

import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;

public class Config {
	private BitmapDrawable org_bm;
	public static final String PREFS_NAME = "SmartTextViewerHKUST";
	private SharedPreferences mysettings;
	public Config(Context parent)
	{
		mysettings = parent.getSharedPreferences(PREFS_NAME, 0);
        org_bm = new BitmapDrawable(BitmapFactory.decodeResource(parent.getResources(), R.drawable.kaede_c2));
        org_bm.setTileModeXY(android.graphics.Shader.TileMode.REPEAT, android.graphics.Shader.TileMode.REPEAT);
        
	}
    public BitmapDrawable return_bg()
    {
    	return org_bm;
    }
    public int GetDefaultfontColor()
    {
 
    	return Utility.return_actualColor(mysettings.getString("DefaultfontColor", "BLACK"));
    //	return ;
    }
    public String getActualfontColor()
    {
    	return mysettings.getString("DefaultfontColor", "BLACK");
    }
    public String getActualfontSize()
    {
    	return mysettings.getString("DefaultfontSize", "17.0");
    }
    public String getActualcharset()
    {
    	return mysettings.getString("Defaultcharset", "utf-8");
    }
    public SharedPreferences getSharedPreferences()
    {
		return mysettings;
    }
    public SharedPreferences.Editor getTheeditor()
    {
    	SharedPreferences.Editor editor = mysettings.edit();
    	return editor;
    }
    public void SetDefaultfontColor(String color)
    {
    	 SharedPreferences.Editor editor = mysettings.edit();
    	 editor.putString("DefaultfontColor", color);
    	 editor.commit();
    }
}
